package com.javacv.plus.extensions.image;

import lombok.Data;
import org.bytedeco.opencv.opencv_core.Mat;

/**
 * 处理结果
 */
@Data
public class ProcessorResult {

    /**
     * 是否处理成功
     */
    private boolean success;

    /**
     * 源文件路径
     */
    private String sourcePath;

    /**
     * 输出文件路径
     */
    private String outputPath;

    /**
     * 处理后的图像
     */
    private Mat processedImage;

    /**
     * 错误信息
     */
    private String errorMessage;

    /**
     * 处理耗时（毫秒）
     */
    private long processTime;

    /**
     * 额外信息
     */
    private Object metadata;

    /**
     * 创建成功结果
     */
    public static ProcessorResult success(String sourcePath, String outputPath, Mat image) {
        ProcessorResult result = new ProcessorResult();
        result.setSuccess(true);
        result.setSourcePath(sourcePath);
        result.setOutputPath(outputPath);
        result.setProcessedImage(image);
        return result;
    }

    /**
     * 创建失败结果
     */
    public static ProcessorResult failure(String sourcePath, String errorMessage) {
        ProcessorResult result = new ProcessorResult();
        result.setSuccess(false);
        result.setSourcePath(sourcePath);
        result.setErrorMessage(errorMessage);
        return result;
    }

    /**
     * 创建失败结果（带异常）
     */
    public static ProcessorResult failure(String sourcePath, Exception e) {
        return failure(sourcePath, e.getMessage());
    }
} 